﻿
using System.Windows;
using YY.Admin.Services;
using YY.Admin.ViewModels.Login;
using YY.Admin.ViewModels;
using YY.Admin.Views;
using System.Windows.Controls;
using YY.Admin.Core.SqlSugar;
namespace YY.Admin
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : PrismApplication
    {
        protected override Window CreateShell()
        {
            return Container.Resolve<LoginWindow>();
        }

        // Bootstrapper中注册
        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            // 注册数据库上下文
            containerRegistry.RegisterSingleton<ISqlSugarDbContext, SqlSugarDbContext>();
            // 服务注册
            containerRegistry.RegisterSingleton<IAuthService, AuthService>();
            containerRegistry.RegisterSingleton<IUserService, UserService>();

            // 注册所有需要导航的视图
            containerRegistry.RegisterForNavigation<DashboardView>("DashboardView");
            containerRegistry.RegisterForNavigation<UserManagementView>("UserManagementView");
            //containerRegistry.RegisterForNavigation<RoleManagementView>("RoleManagementView");
            //containerRegistry.RegisterForNavigation<PermissionManagementView>("PermissionManagementView");
            //containerRegistry.RegisterForNavigation<OrderManagementView>("OrderManagementView");
            //containerRegistry.RegisterForNavigation<ProductManagementView>("ProductManagementView");
            //containerRegistry.RegisterForNavigation<ReportView>("ReportView");
            //containerRegistry.RegisterForNavigation<MonitorView>("MonitorView");

            // 窗口注册
            containerRegistry.RegisterForNavigation<LoginWindow, LoginViewModel>();
            containerRegistry.RegisterForNavigation<MainWindow, MainViewModel>();
        }
    }

}
